﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using yunbo.Model.BIP;
using yunbo.Model.PPMS;
using yunbo.Repositorys.BIPRepositorys;
using yunbo.Repositorys.FPMRepositorys;
using yunbo.Repositorys.PPMSRepositorys;

namespace yunbo.Controllers.PPMSControllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class Mes_SCDDController : ControllerBase
    {
        Mes_SCDDRepository Mes_scddRepository = new Mes_SCDDRepository();


        [HttpGet("GetMes_SCDD")]
        public IActionResult GetMes_SCDD()
        {
            List<Mes_SCDD> quans = Mes_scddRepository.GetMes_SCDD();
            return Ok(quans);
        }

        [HttpPost("AddMes_SCDD")]
        public IActionResult AddMes_SCDD(ADDSCDD scdd)
        {
            var quans = Mes_scddRepository.AddMes_SCDD(scdd);
            return Ok(quans);
        }

        [HttpPut("UpdateStatus")]
        public IActionResult UpdateStatus(string code, int state, int update_by)
        {
            int quans = Mes_scddRepository.UpdateStatus(code, state, update_by);
            return Ok(quans);
        }

        [HttpPut("UpdateMes_SCDD")]
        public IActionResult UpdateMes_SCDD(ADDSCDD scdd)
        {
            int quans = Mes_scddRepository.UpdateMes_SCDD(scdd);
            return Ok(quans);
        }
        [HttpPut("UpdateMesSCDDJD")]
        public IActionResult UpdateMesSCDDJD(int jd, string code)
        {
            bool rs = Mes_scddRepository.UpdateMesSCDDJD(jd, code) > 0;
            return Ok(rs);
        }
    }
}
